package Listeners;

import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;

import GUI.ConferenceWizardFrame;
import GUI.SubmitPaperPanel;
import Model.Conference;
import Model.Paper;
import Model.User;

/**
 * Listener used for the "Edit Paper" button in the
 * AuthorToolPanel.  Takes the user to a new JPanel
 * where they can edit the data for the paper.
 * 
 * @author Paul Schultz (ps87@uw.edu)
 * @version 11/30/2012
 */
@SuppressWarnings("serial")
public class EditPaperListener extends AbstractAction
{
  private Conference my_conference;
  private User my_author;
  private ConferenceWizardFrame my_frame;
  private Paper my_paper;
  
  /**
   * Constructs a new EditPaperListener.
   * 
   * @param the_conf The Conference the paper is in.
   * @param the_frame The master frame for this application.
   * @param the_author The Author of the paper being edited.
   * @param the_paper The Paper to be edited.
   */
  public EditPaperListener(final Conference the_conf, 
      final ConferenceWizardFrame the_frame, final User the_author,
      final Paper the_paper)
  {
    my_conference = the_conf;
    my_author = the_author;
    my_frame =  the_frame;
    my_paper = the_paper;
  }

  /**
   * Takes the user to the SubmitPaperPanel that
   * will allow them to made editions ot the paper.
   */
  @Override
  public void actionPerformed(ActionEvent arg0)
  {
    my_frame.setCurrentPanel(new SubmitPaperPanel(my_author, 
        my_conference, my_frame, my_paper)); 
  }
}
